<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>JOB配置-修改</title>
    <link rel="stylesheet" href="../layui/css/layui.css">
</head>
<body style="padding: 5px">
<!-- 你的HTML代码 -->

        <form class="layui-form" lay-filter="*"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
            <div class="layui-form-item">
                <label class="layui-form-label">任务名称</label>
                <div class="layui-input-block">
                    <input type="text" name="jobName" placeholder="请输入" autocomplete="off" class="layui-input" lay-verify="required" >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">初始时间</label>
                <div class="layui-input-block">
                     <input name="initTime" id="initTime" class="layui-input" lay-verify="required">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">时间戳</label>
                    <div class="layui-input-block">
                        <input type="text" name="period"  lay-verify="number" class="layui-input" >
                    </div>
                </div>
                <div class="layui-inline">
                    <select name="unit">
                        <option value="SECONDS">秒</option>
                        <option value="MINUTES">分钟</option>
                        <option value="HOURS">小时</option>
                        <option value="DAYS">天</option>
                    </select>
                </div>
            </div>

            <!--<div class="layui-form-item">-->
                <!--<div class="layui-inline">-->
                    <!--<label class="layui-form-label">立即执行</label>-->
                    <!--<div class="layui-input-block">-->
                        <!--<input  type="checkbox" name="active" lay-skin="switch" value="Y">-->
                    <!--</div>-->
                <!--</div>-->

                <!--<div class="layui-inline">-->
                    <!--<label class="layui-form-label">执行状态</label>-->
                    <!--<div class="layui-input-block">-->
                        <!--<select name="unit">-->
                            <!--<option value="NORMAL">正常</option>-->
                            <!--<option value="RUN" disabled>运行</option>-->
                            <!--<option value="ERROR" disabled>异常</option>-->
                        <!--</select>-->
                    <!--</div>-->
                <!--</div>-->
            <!--</div>-->

            <div class="layui-form-item">
                <label class="layui-form-label">下载路径</label>
                <div class="layui-input-block">
                    <input type="text" name="uploadPath"  autocomplete="off" class="layui-input"
                           placeholder="目前只支持应用服务器路径"
                           lay-verify="required" >
                </div>
            </div>
            <input name="id" type="hidden" value="">
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
    </form>

<script src="../layui/layui.all.js"></script>
<script>


    var search = window.location.search ;

    //由于模块都一次性加载，因此不用执行 layui.use() 来加载对应模块，直接使用即可：
    ;!function(){
        var layer = layui.layer
        var form = layui.form;
        var table = layui.table;
        var laydate = layui.laydate;
        var $ = layui.$

        laydate.render({
            elem: '#initTime' ,//指定元素
            type:'datetime',
            format:"yyyy-MM-dd HH:mm:ss"
        });

        $.getJSON("../xxdsqljob/getOne"+search,function(rst){

            if(rst.code!=0){
                layer.alert(rst.msg,{icon:2})
            }else{
                form.val("*",rst.data)
            }
        })




        form.on("submit(*)",function(obj){
//            console.log(obj)
            layer.confirm('更新任务信息，需重启才能生效!', {icon: 3, title:'提示'}, function(index){
                layer.close(index);
                $.post("../xxdsqljob/editJobCfg",obj.field,function(rst){
                    if(rst.code!=0){
                        layer.alert(rst.msg,{icon: 2})
                    }else{
                        var index1 = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index1);
                        parent.layer.msg(rst.msg)
                    }
                })
            });
            return false
        })

    }();

</script>

</body>
</html>
